import 'package:flutter_nb_net/flutter_net.dart';

class OrderListResp extends BaseNetModel {
  int? code;
  String? msg;
  List<OrderInfo>? data;

  OrderListResp({this.code, this.msg, this.data});

  @override
  fromJson(Map<String, dynamic> json) {
    return OrderListResp(
      code: json['code'],
      msg: json['msg'],
      data: json['rows'] != null ? List<OrderInfo>.from(json['rows'].map((x) => OrderInfo().fromJson(x))) : null,
    );
  }
}

class OrderInfo extends BaseNetModel {
  int? id;
  String? orderNo;
  int? orderType;
  int? orderStatus;
  String? imei;
  DateTime? createTime;
  double? payAmount;
  double? goodsTotalPrice;
  int? refundStatus;
  FlowPackage? flowPackage;

  OrderInfo({this.id, this.orderNo, this.orderType, this.orderStatus, this.imei, this.createTime, this.payAmount, this.goodsTotalPrice, this.refundStatus, this.flowPackage});

  @override
  fromJson(Map<String, dynamic> json) {
    return OrderInfo(
      id: json['id'],
      orderNo: json['orderNo'],
      orderType: json['orderType'],
      orderStatus: json['orderStatus'],
      imei: json['imei'],
      createTime: json['createTime'] != null ? DateTime.parse(json['createTime']) : null,
      payAmount: json['payAmount'],
      goodsTotalPrice: json['goodsTotalPrice'],
      refundStatus: json['refundStatus'],
      flowPackage: json['flowPackage'] != null ? FlowPackage().fromJson(json['flowPackage']) : null,
    );
  }
}

class FlowPackage extends BaseNetModel {
  int? packageType;
  String? packageCode;
  String? packageName;

  FlowPackage({this.packageType, this.packageCode, this.packageName});

  @override
  fromJson(Map<String, dynamic> json) {
    return FlowPackage(
      packageType: json['packageType'],
      packageCode: json['packageCode'],
      packageName: json['packageName'],
    );
  }
}